/**
*  \file min.h
*
*  \brief filtering with pt1
*
*  \author Marcel Scherer  <marcel.schererb@linde-mh.de>
*
*  filtering with pt1
*/

#ifndef PT1_FILTER_H_INCLUDED
#define PT1_FILTER_H_INCLUDED

/*==========================================================[ public includes  ]==========================================================*/
#include "../cfg/prj.h"

/*==========================================================[ public defines   ]==========================================================*/

/*==========================================================[ public datatypes ]==========================================================*/

/*==========================================================[ public variables ]==========================================================*/

/*==========================================================[ public functions ]==========================================================*/

static inline U8 u8_pt1_filt(U8 filt_value, U8 new_value, F32 time_const)
{
   return ((U8)((F32) filt_value + (( (F32)new_value - (F32) filt_value ) * time_const)));
}

static inline S8 s8_pt1_filt(S8 filt_value, S8 new_value, F32 time_const)
{
   return ((S8)((F32) filt_value + (( (F32)new_value - (F32) filt_value ) * time_const)));
}

static inline U16 u16_pt1_filt(U16 filt_value, U16 new_value, F32 time_const)
{
   return ((U16)((F32) filt_value + (( (F32)new_value - (F32) filt_value ) * time_const)));
}

static inline S16 s16_pt1_filt(S16 filt_value, S16 new_value, F32 time_const)
{
   return ((S16)((F32) filt_value + (( (F32)new_value - (F32) filt_value ) * time_const)));
}

static inline U32 u32_pt1_filt(U32 filt_value, U32 new_value, F32 time_const)
{
   return ((U32)((F32) filt_value + (( (F32)new_value - (F32) filt_value ) * time_const)));
}

static inline S32 s32_pt1_filt(S32 filt_value, S32 new_value, F32 time_const)
{
   return ((S32)((F32) filt_value + (( (F32)new_value - (F32) filt_value ) * time_const)));
}

static inline F32 f32_pt1_filt(F32 filt_value, F32 new_value, F32 time_const)
{
   return ( filt_value + (( new_value - filt_value ) * time_const));
}

#endif

/*******************************************************************************************************************************************
*                                       Copyright 2016 Linde Material Handling. All rights reserved.                                       *
*******************************************************************************************************************************************/
